package GameLogic
{
	import flash.display.Bitmap;
	import flash.display.BitmapData;
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.events.MouseEvent;
	import flash.ui.Mouse;
	import flash.ui.MouseCursor;
	import flash.utils.Dictionary;
	import SoundManager.SoundFactory;

	public class PauseBtn extends Sprite
	{
		public var Check:Boolean;
		private var a_bmp:Bitmap;
		private var b_bmp:Bitmap;
		
		public function PauseBtn(_a:BitmapData,_b:BitmapData,_defaultState:Boolean)
		{
			a_bmp = new Bitmap(_a);
			b_bmp = new Bitmap(_b);
			addChild(a_bmp);
			addChild(b_bmp);
			Check = _defaultState;	
			this.addEventListener(MouseEvent.CLICK, function(e:Event):void
			{
				Check = !Check;
				Game.Pause = Check;
				SoundFactory.Sounds["button1"].play();
			});
			this.addEventListener(MouseEvent.MOUSE_OVER, function(e:Event):void
			{
				Mouse.cursor = MouseCursor.BUTTON;
			});
			this.addEventListener(MouseEvent.MOUSE_OUT, function(e:Event):void
			{
				Mouse.cursor = MouseCursor.AUTO;
			});
			this.addEventListener(Event.ENTER_FRAME, function(e:Event):void
			{
				if (Game.Pause)
				{
					a_bmp.visible = true;
					b_bmp.visible = false;
				} 
				else
				{
					a_bmp.visible = false;
					b_bmp.visible = true;
				}
			});
		}
		
	   
	}
}